﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;
using System.Data;

/// <summary>
/// Descripción breve de AccesoDatos
/// </summary>
public class AccesoDatos
{
    private SqlConnection cn;
    private SqlCommand cm;
    private SqlDataAdapter ad;
    //DataSet ds;

    
	public AccesoDatos()
	{
         cn = new SqlConnection("Data Source=HUNTER-PC;Initial Catalog=BaseGelForm;Integrated Security=True");
         cn.Open();
            
	}
    ~AccesoDatos()
    {
       // cn.Close();
    }
    
    public DataTable listarPatologias()
    {
        DataTable aux=new DataTable();
        cm = new SqlCommand();
        ad = new SqlDataAdapter();
        cm.Connection = cn;
        cm.CommandType = CommandType.StoredProcedure;
        cm.CommandText = "ListarPatologias";
        cm.ExecuteNonQuery();
        ad.SelectCommand = cm;
        ad.Fill(aux);
        return aux;

    }
    public DataTable ArticulosPatologia(string Patologia)
    {
        DataTable aux = new DataTable();
        cm = new SqlCommand();
        ad = new SqlDataAdapter();
        cm.Connection = cn;
        cm.CommandType = CommandType.StoredProcedure;
        cm.Parameters.AddWithValue("Patologia",Patologia);
        cm.CommandText = "filtrarArticulos";
        cm.ExecuteNonQuery();
        ad.SelectCommand = cm;
        ad.Fill(aux);
        return aux;
    }


}